<table id="table-teams" class="table table-striped table-condensed">
    <thead>
        <tr>
            <th>Lp.</th>
            <td></td>
            <th>Nazwa</th>
            <th>Rozgrywki</th>
            <th>Liga</th>
            <th>Miasto</th>
        </tr>
    </thead>
    <tbody>
        <?php
        $i = 1;
        foreach($teams as $teami=>$teamv)
        {
            echo '<tr>'
                    .'<td>'.$i.'</td>'
                    .'<td><img class="thumbnail" src="'.((empty($teamv['logo'])) ? place_img(32,32,'4d99e0','4d99e0') : base_url($this->config->item('image_team_path').$teamv['logo'])).'" alt="Logo: '.$teamv['code'].'" width="32" height="32"/></td>'
                    .'<td>'.anchor('team/show_team/'.$teami,$teamv['name']).'</td>'
                    .'<td>';
                    $clen = count($teamv['comps']);
                    foreach($teamv['comps'] as $ci=>$cv)
                        echo anchor('league/show_comp/'.$ci,$cv['code'],array('title'=>$cv['name'])).(($clen>0) ? '<br/>' : '');
                echo '</td>'
                    .'<td>';
                    foreach($teamv['comps'] as $c)
                    {
                        $llen = count($c['ligi']);
                        foreach($c['ligi'] as $li=>$lv)
                            echo anchor('league/show_league/'.$li,$lv['code'],array('title'=>$lv['name'])).(($llen>0) ? '<br/>' : '');
                    }
                echo '</td>'
                    .'<td>';
                    foreach($teamv['comps'] as $c)
                        echo $c['city'].(($clen>0) ? '<br/>' : '');
                echo '</td>'
                .'</tr>';
                $i++;
        }
        ?>
    </tbody>
</table>